import { useI18n } from 'vue-i18n'

import { RoleCriteria } from '@/apis/role/type/dto'
import { StatusEnum } from '@/types/enum'
import { FormInputList } from '@/types/interface'

export function useSearchForm() {
  const { t } = useI18n()

  // 表单配置
  const searchFormList = computed((): FormInputList<RoleCriteria> => {
    return [
      {
        key: 'name',
        type: 'input',
        label: t('menus.name'),
        placeholder: t('common.please_enter', { name: t('menus.name') }),
      },
      {
        key: 'status',
        type: 'select',
        label: t('common.status'),
        placeholder: t('common.please_select', { name: t('common.status') }),
        options: [
          { label: t('common.status_enable'), value: StatusEnum.DYNAMIC },
          { label: t('common.status_disable'), value: StatusEnum.STATIC },
        ],
      },
    ]
  })

  return {
    searchFormList,
  }
}
